import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 高生平
 * Date: 2025-09-01
 * Time: 19:37
 */
public class Test {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int k = random.nextInt(101);//生成0 ~ 100 的随机数，作为要猜的目标数字
        //开始猜数字
        while(true) {
            System.out.println("请输入你要猜的数字：（范围为1 ~ 100）");
            int num = scanner.nextInt();
            if (num == k) {
                System.out.println("恭喜你，你猜对了");
                break;
            } else if (num > k) {
                System.out.println("猜大了");
            } else {
                System.out.println("猜小了");
            }
        }
    }
}
